import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/index',
      name: 'index',
      component: () => import('../views/index/index.vue'),
      children:[
        {
          path: '/index/home',
          name: 'home',
          component: () => import('../views/index/home/home.vue'),
        },
        {
          path: '/index/swiper',
          name: 'swiper',
          component: () => import('../views/index/swiper/swiper.vue'),
        },
        {
          path: '/index/swiperadd',
          name: 'swiperadd',
          component: () => import('../views/index/swiperadd/swiperadd.vue'),
        },
        {
          path: '/index/admin',
          name: 'admin',
          component: () => import('../views/index/admin/admin.vue'),
        },
        {
          path: '/index/cplb',
          name: 'cplb',
          component: () => import('../views/index/cpgl/cplb.vue'),
        },
        {
          path: '/index/mslb',
          name: 'mslb',
          component: () => import('../views/index/cpgl/mslb.vue'),
        },
        {
          path: '/index/tjlb',
          name: 'tjlb',
          component: () => import('../views/index/cpgl/tjlb.vue'),
        },
        {
          path: '/index/sxlb',
          name: 'sxlb',
          component: () => import('../views/index/cpgl/sxlb.vue'),
        },
        {
          path: '/index/echarts',
          name: 'echarts',
          component: () => import('../views/index/shujuksh/echarts.vue'),
        },
        {
          path: '/index/bianjiqi',
          name: 'bianjiqi',
          component: () => import('../views/index/bianjiqi/bianjiqi.vue'),
        },
        {
          path: '/index/excel',
          name: 'excel',
          component: () => import('../views/index/excel/excel.vue'),
        },
        {
          path: '/index/baidumap',
          name: 'baidumap',
          component: () => import('../views/index/map/baidumap.vue'),
        },
        {
          path: '/index',
          redirect:'/index/home'
        },
       
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/login/login.vue')
    },
    {
      path: '/',
      redirect: '/index',
    },
    {
      path: '/:error(.*)', //404路由
      component: ()=>import('../views/notfound/index.vue')
    }
  ]
})

export default router
